<template>
  <div id="app">
    <div class="nav">
      <div class="nav-title">
        <span class="nav-title-txt">文件上传演示demo(vue2)</span>
      </div>
      <div class="nav-btns">
        <el-button class="btn-item" type="primary" @click="changeNav(0)">input元素实现文件上传</el-button>
        <el-button class="btn-item" type="primary" @click="changeNav(1)">form表单实现文件上传</el-button>
        <el-button class="btn-item" type="primary" @click="changeNav(2)">input元素实现多文件上传</el-button>
        <el-button class="btn-item" type="primary">大文件切片上传</el-button>
        <el-button class="btn-item" type="primary">大文件断点续传</el-button>
      </div>
    </div>
    <div class="content">
      <!-- 一级路由挂载点 -->
      <router-view></router-view>
    </div>
    <div class="info">
      <marquee class="nav-title-tip" direction="left">提示:后端接口基于本地spring boot项目:http://127.0.0.1:8090/uploadByBlob OR http://127.0.0.1:8090/uploadByBase64</marquee>
    </div>
  </div>
</template>

<script>
import router from './router';
export default {
  name: 'App',
  methods:{
    //导航切换
    changeNav(type = 0){
      switch (type) {
        case 0:
          if(!router.currentRoute.path.includes('/demo1')){
            router.push("/demo1");
          }
          break;
        case 1:
          if(!router.currentRoute.path.includes('/demo2')){
            router.push("/demo2");
          }
          break;
        case 2:
          if(!router.currentRoute.path.includes('/demo3')){
            router.push("/demo3");
          }
        default:
          break;
      }
    }
  }
}
</script>

<style>
#app{
  width: 100%;
  height: 100%;
  display: flex;
  flex-wrap: wrap;
}
.nav{
  width: 300px;
  height: 650px;
  margin: 0 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: #c3afaf;
}
.nav-title{
  height: 100px;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.nav .nav-title .nav-title-txt{
  font-size: 18px;
  font-weight: bold;
  color: #3434d1;
}
.nav .nav-title .nav-title-tip{
  font-size: 12px;
  color: white;
}
.nav-btns{
  display: flex;
  height: 400px;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
}
.nav-btns .btn-item{
  width: 200px;
}
.content{
  width: 1180px;
  height: 650px;
  background-color: #efefef;
}
.info{
  width: 100%;
  height: 30px;
  line-height: 30px;
  color: #9195a3;
}
</style>
